<include file="Public:header" />
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header" style="border:none; font-size:14px; ">
		<ul class="nav nav-tabs">
		   <li class="active"><a  href="{:U('log/index')}"><img src="__PUBLIC__/img/my_log.png"/>&nbsp; {:L('WORK STATEMENTS')}</a></li>
		   <li><a href="{:U('log/anly')}"><img src="__PUBLIC__/img/tongji.png"/>&nbsp; {:L('ADVANCES IN STATISTICS')}</a></li>
		</ul>
	</div>
	<include file="Public:alert" />
	<p class="view"><b>{:L('VIEW_NAV')}</b>
	<img src=" __PUBLIC__/img/by_owner.png"/> <a href="{:U('log/index')}" <if condition="$Think.get.by eq null">class="active"</if>>{:L('ALL')}</a> |
	<a href="{:U('log/index','by=me')}" <if condition="$Think.get.by eq 'me'">class="active"</if>>{:L('MY_LOG')}</a> |
	<a href="{:U('log/index','by=sub')}" <if condition="$Think.get.by eq 'sub'">class="active"</if>>{:L('SUBORDINATE_LOG')}</a> &nbsp; &nbsp; &nbsp; &nbsp;
	<img src="__PUBLIC__/img/by_time.png"/> <a href="{:U('log/index','by=today')}" <if condition="$Think.get.by eq 'today'">class="active"</if>>{:L('CREATE_TODAY')}</a> | 
	<a href="{:U('log/index','by=week')}" <if condition="$Think.get.by eq 'week'">class="active"</if>>{:L('CREATE_THIS_WEEK')}</a> | 
	<a href="{:U('log/index','by=month')}" <if condition="$Think.get.by eq 'month'">class="active"</if>>{:L('CREATE_THIS_MONTH')}</a> | 
	<a href="{:U('log/index','by=add')}" <if condition="$Think.get.by eq 'add'">class="active"</if>>{:L('RECENTLY_CREATED')}</a> | 
	<a href="{:U('log/index','by=update')}" <if condition="$Think.get.by eq 'update'">class="active"</if>>{:L('RECENTLY_MODIFIED')}</a>
	</p>
	<div class="row">
		<div class="span2 knowledgecate">
			<ul class="nav nav-list">
				<li class="active">
					<a href="javascript:void(0);">{:L('VIEW_BY_LOG_CATEGORY')}</a>
				</li>
				<li><a href="{:U('log/index','by='.$_GET['by'])}" <if condition="$_GET['type'] eq null">class="active"</if>><i class="icon-white icon-chevron-right"></i>{:L('ALL')}</a></li>
				<volist name="category_list" id="vo">
					<li><a href="{:U('log/index','type='.$vo['category_id'].'&by='.$_GET['by'])}" <if condition="$_GET['type'] eq $vo['category_id']">class="active"</if>><i class="icon-chevron-right"></i>{$vo['name']}</a></li>
				</volist>
			</ul>
		</div>
		<div class="span10">
			<php>if($_GET['type'] == 1 ){</php><p style="font-size:14px;"><if condition="$_GET['type'] == 1">
					<b>{:L('SELECT_MODULE')}</b><a <if condition="$_GET['module'] == null">class="active"</if> href="{:U('Log/index','by='.$_GET['by'].'&type=1')}">{:L('ALL_MODULE')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'customer'">class="active"</if> href="{:U('Log/index','r=rCustomerLog&module=customer&by='.$_GET['by'].'&type=1')}">{:L('CUSTOMER')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'contacts'">class="active"</if> href="{:U('Log/index','r=rContactsLog&module=contacts&by='.$_GET['by'].'&type=1')}">{:L('CONTACTS')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'business'">class="active"</if> href="{:U('Log/index','r=rBusinessLog&module=business&by='.$_GET['by'].'&type=1')}">{:L('BUSINESS')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'task'">class="active"</if> href="{:U('Log/index','r=rLogTask&module=task&by='.$_GET['by'].'&type=1')}">{:L('TASK')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'event'">class="active"</if> href="{:U('Log/index','r=rEventLog&module=event&by='.$_GET['by'].'&type=1')}">{:L('EVENT')}</a> &nbsp; | &nbsp; 
					<a <if condition="$_GET['module'] == 'leads'">class="active"</if> href="{:U('Log/index','r=rLeadsLog&module=leads&by='.$_GET['by'].'&type=1')}">{:L('LEADS')}</a>
			</if></p><php>}</php>
			<ul class="nav pull-left">		
				<li class="pull-left"><a id="delete" class="btn" style="margin-right: 8px;"><i class="icon-remove"></i>&nbsp;{:L('DELETE')}</a> </li>
				<li class="pull-left">
					<form class="form-inline" id="searchForm" onsubmit="return checkSearchForm();" action="index.php" method="get">
						<ul class="nav pull-left">
							<li class="pull-left">
								<select id="field" style="width:auto" onchange="changeCondition()" name="field">
									<option class="all" value="all">{:L('ANY_FIELDS')}</option>
									<option class="role" value="role_id">{:L('ROLE_NAME')}</option>
									<option class="word" value="subject">{:L('SUBJECT')}</option>
									<option class="word" value="content">{:L('CONTENT')}</option>
									<option class="date" value="create_date">{:L('CREATE_TIME')}</option>
									<option class="date" value="update_date">{:L('UPDATE_TIME')}</option>
								</select>&nbsp;&nbsp;
							</li>
							<li id="conditionContent" class="pull-left">
							<select id="condition" style="width:auto" name="condition" onchange="changeSearch()">
								<option value="contains">{:L('CONTAINS')}</option>
								<option value="not_contain">{:L('NOT_CONTAIN')}</option>
								<option value="is">{:L('IS')}</option>
								<option value="isnot">{:L('ISNOT')}</option>						
								<option value="start_with">{:L('START_WITH')}</option>
								<option value="end_with">{:L('END_WITH')}</option>
								<option value="is_empty">{:L('IS_EMPTY')}</option>
								<option value="is_not_empty">{:L('IS_NOT_EMPTY')}</option>
								</select>&nbsp;&nbsp;
							</li>
							<li id="searchContent" class="pull-left"><input id="search" type="text" class="input-medium search-query" name="search"/>&nbsp;&nbsp;</li>
							<li class="pull-left"><input type="hidden" name="m" value="log"/>
							<if condition="$Think.get.by neq null"><input type="hidden" name="by" value="{$Think.get.by}"/></if>
							<if condition="$Think.get.type neq null"><input type="hidden" name="type" value="{$Think.get.type}"/></if>
							<if condition="$Think.get.module neq null"><input type="hidden" name="module" value="{$Think.get.module}"/></if>
							<if condition="$Think.get.r neq null"><input type="hidden" name="r" value="{$Think.get.r}"/></if>
							<button type="submit" class="btn"> <img src="__PUBLIC__/img/search.png"/>  {:L('SEARCH')}</button></li>
						</ul>
					</form>
				</li>
			</ul>
			<div class="pull-right">
				<a href="{:U('log/mylog_add')}" class="btn btn-primary"><i class="icon-plus"></i>&nbsp; {:L('ADD_LOG')}</a>
			</div>
		</div>
		<div class="span10">
			<form id="form1" method="post">
			<table class="table table-hover table-striped table_thead_fixed">
				<if condition="$list eq null">
					<tr><td>{:L('EMPTY_TPL_DATA')}</td></tr>
				<else/>
					<thead>
						<tr>
							<th><input id="check_all" class="control_all" type="checkbox" /></th>
							<th width="10px"></th>
							<th>{:L('SUBJECT')}</th>
							<th>{:L('ROLE_NAME')}</th>
							<th>
								<if condition="$_GET['asc_order'] == 'create_date'">
									<a href="{:U('log/index','desc_order=create_date&'.$parameter)}">
										{:L('CREATE_TIME')}&nbsp;<img src="__PUBLIC__/img/arrow_up.png">
									</a>
								<elseif condition="$_GET['desc_order'] == 'create_date'"/>
									<a href="{:U('log/index','asc_order=create_date&'.$parameter)}">
										{:L('CREATE_TIME')}&nbsp;<img src="__PUBLIC__/img/arrow_down.png">
									</a>
								<else/>
									<a href="{:U('log/index','desc_order=create_date&'.$parameter)}">{:L('CREATE_TIME')}</a>
								</if>
							</th>
							<th>{:L('UPDATE_TIME')}</th>
							<th>{:L('OPERATING')}</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="7">
								<p>{:L('NOTE')} <span style="color:green"><i class="icon-check"></i></span>{:L('HAVE_SUPERIORS_COMMENTS')} &nbsp; &nbsp;  <span style="color:red"><i class="icon-edit"></i></span>{:L('NO_SUPERIORS_COMMENTS')}</p>
								{$page}
							</td>
						</tr>
					</tfoot>
					<tbody>
						<volist name="list" id="vo">
						<tr>
							<td><input class="check_list" type="checkbox" name="log_id[]" value="{$vo.log_id}"/></td>
							<td><if condition="$vo['is_comment']"><span style="color:green"><i class="icon-check"></i></span><else /><span style="color:red"><i class="icon-edit"></i></span></if></td>
							<td>
								<a href="{:U('log/mylog_view','id='.$vo['log_id'].'&type='.$_GET['type'].'&by='.$_GET['by'].'&field='.$_GET['field'].'&condition='.$_GET['condition'].'&search='.$_GET['search'])}">
									<if condition="$vo['subject'] ">{$vo.subject}<else />{$vo['content']|msubstr=###,0,35}...</if>
								</a>
							</td>
							<td><notempty name="vo.creator.user_name"><a class="role_info" rel="{$vo.creator.role_id}" href="javascript:void(0)">{$vo.creator.user_name}</a></notempty></td>
							<td>{$vo.create_date|date="Y-m-d H:i",###}</td>
							<td>{$vo.update_date|date="Y-m-d H:i",###}</td>
							<td>
								<a href="{:U('log/mylog_view','id='.$vo['log_id'].'&type='.$_GET['type'].'&by='.$_GET['by'].'&field='.$_GET['field'].'&condition='.$_GET['condition'].'&search='.$_GET['search'])}">{:L('VIEW')}</a>&nbsp;&nbsp;
								<a href="{:U('log/mylog_edit','id='.$vo['log_id'].'&type='.$_GET['type'])}">{:L('EDIT')}</a>
							</td>
						</tr>
						</volist>
					</tbody>
				</if>
			</table>
			</form>
		</div>
	</div>
</div>
<div class="hide" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">loading...</div>
<script type="text/javascript">
$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 400,
	position: ["center",100]
});
$(function(){
	<if condition="$Think.get.field neq null">
		$("#field option[value='{$Think.get.field}']").prop("selected", true);changeCondition();
		$("#condition option[value='{$Think.get.condition}']").prop("selected", true);changeSearch();
		$("#search").prop('value', '{$Think.get.search}');
	</if>
	$('#delete').click(function(){
		if( $("input[class='check_list']:checked").length > 0 ){
			if(confirm("{:L('CONFIRM_DELETE')}")){
				$("#form1").attr('action', '{:U("log/log_delete")}');
				$("#form1").submit();
			}
		}else{
			alert('{:L("PLEASE SELECT DELETE ITEMS")}');
		}
	});
	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
	$("#check_all").click(function(){
		$("input[class='check_list']").prop('checked', $(this).prop("checked"));
	});
})
function changeContent(){
	$module = $('#module').val();
	if($module == 6){
		window.location='{:U('Log/index','by='.$_GET['by'].'&type=4')}';
	}else if($module == 1){
		window.location='{:U('Log/index','r=rCustomerLog&module=customer&by='.$_GET['by'].'&type=1')}';
	}else if($module == 2){
		window.location = '{:U('Log/index','r=rContactsLog&module=contacts&by='.$_GET['by'].'&type=1')}';
	}else if($module == 3){
		window.location='{:U('Log/index','r=rBusinessLog&module=business&by='.$_GET['by'].'&type=1')}';
	}else if($module == 4){
		window.location='{:U('Log/index','r=rLogTask&module=task&by='.$_GET['by'].'&type=1')}';
	}else if($module == 5){
		window.location='{:U('Log/index','r=rEventLog&module=event&by='.$_GET['by'].'&type=1')}';
	}
}
</script>
<include file="Public:footer" />
